﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PPI.Client.Logic.Inspection;
using PPI.Client.Logic.XML;
using PPI.Client.Utils;
using PPI.Entities.Enumerator;
using PPI.Entities.Inspections;
using PPI.Entities.XML;
using PPI.General;

namespace PPI
{
    public partial class frmOutbox : frmBase
    {
        protected EXmlOutboxBase m_OutboxBase;
        public EXmlOutboxBase OutboxBase
        {
            set { m_OutboxBase = value; }
        }

        public EXmlOutboxBase SelectedOutbox
        {
            get { return m_SelectedOutbox; }
        }

        protected EXmlOutboxBase m_SelectedOutbox;

        public frmOutbox()
        {
            InitializeComponent();
            base.MenuMain.Visible = false;
            this.FormSize = FormSizes.Medium;
        }

        private void frmOutbox_Load(object sender, EventArgs e)
        {
            try
            {
                this.outboxDatabase1.EntityXml = m_OutboxBase;
                this.outboxDatabase1.LoadAllOutboxesToUpload();

            }
            catch (Exception ex)
            {
                RegisterError.SaveError(ex);
            }
        }

        private void btnView_Click(object sender, EventArgs e)
        {
            if(outboxDatabase1.HasDatabases())
            {
                this.DialogResult = DialogResult.OK;
                m_SelectedOutbox = outboxDatabase1.SelectedOutbox;
                this.Close();
            }
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Ignore;
            this.Close();
        }
    }
}
